package com.netx.ebs;
import com.netx.data.EntityInstance;
import com.netx.generics.sql.Row;
import com.netx.generics.time.Moment;


public class Error extends EntityInstance {

	private final User _user;
	private final String _requestURL;
	private final String _message;
	private final String _stackTrace;
	private final Moment _timeOcurred;
	
	Error(Row data, User u) {
		super(data.getLong(1));
		_user = u;
		_requestURL = data.getString(2);
		_message = data.getString(3);
		_timeOcurred = data.getMoment(4);
		_stackTrace = data.getString(5);
	}
	
	public User getUser() {
		return _user;
	}
	
	public String getRequestURL() {
		return _requestURL;
	}

	public String getMessage() {
		return _message;
	}
	
	public Moment getTimeOcurred() {
		return _timeOcurred;
	}

	public String getStackTrace() {
		return _stackTrace;
	}
	
	public String toString() {
		return "Error by \""+_user.getUsername()+"\" @ "+getTimeOcurred()+": "+getMessage();
	}
}
